{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import requests\n",
    "def get_xzpd(men,women):\n",
    "    key = \"2aaf134d4a120511d74719d01e8eaff9\"\n",
    "    payload = {\n",
    "    'men': men,\n",
    "    'women': women,\n",
    "    'key':key\n",
    "        \n",
    "    }\n",
    "    req = requests.get('http://apis.juhe.cn/xzpd/query', params=payload)\n",
    "    return req.json()['result']\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "data = get_xzpd(\"摩羯\",\"射手\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'men': '摩羯',\n",
       " 'women': '射手',\n",
       " 'zhishu': '70',\n",
       " 'bizhong': '46:54',\n",
       " 'xiangyue': '80',\n",
       " 'tcdj': '60',\n",
       " 'jieguo': '小吵小闹的一对',\n",
       " 'lianai': '土象星座和火象星座本来就存在有不可跨越的鸿沟，你们观念不同，在一起是会有很多烦恼。射手有时想破脑袋也搞不清楚为什么摩羯做事会那样守旧、谨慎，而且缺乏生活品味。但在摩羯眼里，会觉得射手才是不会过日子的人，有勇无谋，事情往往可以处理得更好，但却不会算计。幸好你们的星座排列是紧邻，多少都弥补了点，虽然也是两个极端，但只要找到最舒服的相处模式，你们还是可以和平共处。你们想要维持长久的关系，首先要好好了解对方，取长补短，互相学习，这才是上策。',\n",
       " 'zhuyi': '开朗自由的射手，承受力低，但却喜欢冒险，所以她们常常会因压力而改变。看着凡事一步一脚印去做事的摩羯，总觉得他们闷到爆了，而且喜怒哀乐不形于色。射手往往跟摩羯讲完一大串后，得到的回应往往是几声“嗯”，其实射手说的摩羯都有听进去，只不过摩羯在心里做评估而已。律人律己、努力做人做事是摩羯的天性。其实射手做事三分钟热度，有点自私的个性，也比摩羯好不到哪里去。喜欢探索世界、追求冒险的射手，要在适当的时候告诉摩羯自己内心的想法，让摩羯知道你虽然向往外面的世界，但家才是你最值得向往的那一个地方。这样做，摩羯才会放下悬着的心。射手可以将摩羯当长辈去看待，用可爱活泼的攻势去软化摩羯，不要只会对着摩羯吼！'}"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'摩羯'"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "str(data['men'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "str"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(data['men'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
